cmd line tutorials - gencmd

cmd line tutorials - gencmd

The join Command

Unix-Linux Mac

The join command is a text processing tool that can be used to merge two files based on a common field.

Syntax

The basic syntax for the join command is as follows:

join [options] file1 file2

The file1 and file2 arguments are the names of the files that you want to merge. The options argument is a list of options that can be used to modify the behavior of the join command.

Examples

Combine data from two files. By defaut join uses the first column as the key.

join file1.txt file2.txt

Combine files based on the second field:

join -j2 file1.txt file2.txt

Options

The join command has a number of options that can be used to modify its behavior. Some of the most common options are:

-i: ignore case difference.

-t <character>: Specify the character that is used separator.

For more information on the join command and its options, please see the man page: man join.

With gencmd

gencmd join two files where separator is tab

  • join -t “\t” file1 file2